package com.xq.shop.po;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.hibernate.annotations.Cascade;
import org.hibernate.annotations.CascadeType;

@Entity
@Table(name="user_order")
public class Order {

	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	private Long id;
	private String sn;
	private Long user_id;
	private Integer pay;
	private Integer free;
	private Integer amount;
	private Integer point;
	private String shipping_method;
	private Integer shipping_status;
	
	@Temporal(TemporalType.TIMESTAMP)
	@Column(updatable=false)
	private Date create_date = new Date();
	private Date modify_date;
	private Date expire_date;
	private String operator;
	private Date lock_date;
	private String address;
	private String contact;
	private Long tel;
	private String postcode;
	private Integer status;
	
	@OneToMany
	@JoinColumn(name="order_id")
	@Cascade(CascadeType.SAVE_UPDATE)
	private List<OrderItem> items = new ArrayList<OrderItem>();
	
	public Long getId() {
		return id;
	}
	public void setId(Long id) {
		this.id = id;
	}
	public String getSn() {
		return sn;
	}
	public void setSn(String sn) {
		this.sn = sn;
	}
	public Long getUser_id() {
		return user_id;
	}
	public void setUser_id(Long userId) {
		user_id = userId;
	}
	public Integer getPay() {
		return pay;
	}
	public void setPay(Integer pay) {
		this.pay = pay;
	}
	public Integer getFree() {
		return free;
	}
	public void setFree(Integer free) {
		this.free = free;
	}
	public Integer getAmount() {
		return amount;
	}
	public void setAmount(Integer amount) {
		this.amount = amount;
	}
	public Integer getPoint() {
		return point;
	}
	public void setPoint(Integer point) {
		this.point = point;
	}
	public String getShipping_method() {
		return shipping_method;
	}
	public void setShipping_method(String shippingMethod) {
		shipping_method = shippingMethod;
	}
	public Integer getShipping_status() {
		return shipping_status;
	}
	public void setShipping_status(Integer shippingStatus) {
		shipping_status = shippingStatus;
	}
	public Date getCreate_date() {
		return create_date;
	}
	public void setCreate_date(Date createDate) {
		create_date = createDate;
	}
	public Date getModify_date() {
		return modify_date;
	}
	public void setModify_date(Date modifyDate) {
		modify_date = modifyDate;
	}
	public Date getExpire_date() {
		return expire_date;
	}
	public void setExpire_date(Date expireDate) {
		expire_date = expireDate;
	}
	public String getOperator() {
		return operator;
	}
	public void setOperator(String operator) {
		this.operator = operator;
	}
	public Date getLock_date() {
		return lock_date;
	}
	public void setLock_date(Date lockDate) {
		lock_date = lockDate;
	}
	public String getAddress() {
		return address;
	}
	public void setAddress(String address) {
		this.address = address;
	}
	public String getContact() {
		return contact;
	}
	public void setContact(String contact) {
		this.contact = contact;
	}
	public Long getTel() {
		return tel;
	}
	public void setTel(Long tel) {
		this.tel = tel;
	}
	public String getPostcode() {
		return postcode;
	}
	public void setPostcode(String postcode) {
		this.postcode = postcode;
	}
	public Integer getStatus() {
		return status;
	}
	public void setStatus(Integer status) {
		this.status = status;
	}
	public List<OrderItem> getItems() {
		return items;
	}
	public void setItems(List<OrderItem> items) {
		this.items = items;
	}
	
}
